<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>map</title>
</head>
<body>
<script>
    let arr = [1, 2, 5, -1, -34, -45, 11];
    let newarr = arr.map(element => element > 0 ? element : 0);
    console.log(arr);
    console.log(newarr);
</script>
</body>
</html>